#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
#include<vector>

int main() {
    int year;
    int month;
    int day;
    cin >> year >> month >> day;
    int count = 0;
    vector<int> v1{ -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    for (int i = 1; i < month; i++) {
        count += v1[i];
    }
    count += day;
    if (((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) && month > 2) {
        count += 1;
    }

    cout << count;

}